<? session_start();
						
include_once ('core/conn.php');
						
$db = get_conn();
						
check_session();
						
if($_GET['id'] != ''){
							
	$sql = " select * from invoices_type where id_it=".$_GET['id']; 
							
	$result = mysql_query($sql);	
							
	if($result){
								
		$row = mysql_fetch_array($result);
		$id_it = $row['id_it'];
		$name = $row['name'];
		$code = $row['code'];
		$bank_acc = $row['bank_acc'];
		$bank_acc_owner = $row['bank_acc_owner'];
		$base_amount = $row['base_amount'];
							
	}else{
								
		error_handling($sql,mysql_error());
							
	}
						
}
						
						
					
?>
					
					
<html>
					
<head>
					
					

				
				
<script>
					
<!--
						
	function checkdata(obj){
							
				
						
							
		if(obj.name.value ==''){
								
			alert('Debe indicar el nombre');
								
			obj.name.focus();
								
			return false;
							
		}
							
		if(obj.code.value ==''){
								
			alert('Debe indicar el codigo');
								
			obj.code.focus();
								
			return false;
							
		}
							
		if(obj.base_amount.value ==''){
								
			alert('Debe indicar el monto base');
								
			obj.base_amount.focus();
								
			return false;
							
		}
							
		if(isNaN(obj.base_amount.value) ){
								
			alert('El monto base debe ser un numero');
								
			obj.base_amount.focus();
								
			return false;
							
		}				
						
	return true;
						
	}
					
-->
					
</script>
					
</head>									
					
<body>														
				
				
<form name='invoices_type' method='post' action='/core/invoices_types.php' onsubmit='return checkdata(this)'>
  <table width='50%' border='0'>
    <tr>
      <td width="12%" align='left'> Nombre </td>
      <td width="88%" align='left'><input type='text' name='name' value='<? echo $name;?>'>
        <input type='hidden' name='id_it' value='<? echo $id_it;?>'></td>
    </tr>
    <tr>
      <td align='left'> Codigo</td>
      <td align='left'><input type='text' name='code' value='<? echo $code;?>'></td>
    </tr>
    <tr>
      <td align='left' nowrap> Numero de Cuenta </td>
      <td align='left'><input type='text' name='bank_acc' value='<? echo $bank_acc;?>'></td>
    </tr>
    <tr>
      <td align='left'> a nombre de</td>
      <td align='left'><input type='text' name='bank_acc_owner' value='<? echo $bank_acc_owner;?>'></td>
    </tr>
    <tr>
      <td align='left'> Monto Base</td>
      <td align='left'><input type='text' name='base_amount' value='<? echo $base_amount;?>'></td>
    </tr>
    <tr>
      <td colspan='2' align='center'><?
							  
					if ($_GET['id'] != ""){
								
						echo "<input type='submit' name='Actualizar' value='Actualizar'>";
								
						echo "<input type='submit' name='Eliminar' value='Borrar'>";										
								
						echo "<input type='submit' name='Nuevo' value='Cancelar'>";
							  
					}else{
								
						echo "<input type='submit' name='Agregar' value='Agregar'>";
							  
					}
							 
					?></td>
    </tr>
  </table>
</form>
					
</body></html>													
					